//
//  LGCultureCommucateViewController.m
//  ligenyun
//
//  Created by Mac on 2018/3/28.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "LGCultureDynastyViewController.h"
#import "LGCultureHomeTableViewCell.h"
#import "LGCultureDynastyViewController.h"
@interface LGCultureDynastyViewController ()

@end

@implementation LGCultureDynastyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"唐朝祭祀文化";
    [self configSubView];
    // Do any additional setup after loading the view.
}

#pragma mark --subView
- (void)configSubView{
    UIView * header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 30)];
    UIImageView * bannerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, UIScreenWidth, 150)];
    bannerImageView.image = [UIImage imageNamed:@"文化交流banner"];
    [header addSubview:bannerImageView];
    header.height = bannerImageView.bottom;
    self.tableView.tableHeaderView = header;
}
#pragma --mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 6;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return [LGCultureHomeTableViewCell cellHeight];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{

    return 140;
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 140)];
    UIView * section1 = [TMUtils headerViewWithTitle:@"活动视屏" moreButtonAction:^(UIButton *sender) {
        
    }];
    [view addSubview:section1];
    __weak typeof(self) weakSelf =  self;
    LGCultureVideoCollectionView * collectionView = [LGCultureVideoCollectionView initWithDefultFrame];
    collectionView.top = section1.bottom;
    [collectionView setOnSelectedButton:^(NSObject *model) {
         [weakSelf.navigationController pushViewController:[LGCultureVideoDetailViewController new] animated:YES];
    }];
    [view addSubview:collectionView];
    return view;
}
- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return [UIView new];
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * reuseIdentifier =  @"cell";
    LGCultureHomeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[LGCultureHomeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
    }
    
    return cell;
}
#pragma --mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [self.navigationController pushViewController:[LGCultureDetailViewController new] animated:YES];
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
}
#pragma mark --Action Method


@end

